require "Util.SystemUtil"

module("SystemUtilTest", package.seeall, lunit.testcase)

function test_tryCall()
	local call1 = function(...)
		return ...
	end

	local result1 = { tryCall(call1, true, 1, 0.1, "string") }
	assert_true(result1[1])
	assert_true(result1[2])
	assert_equal(1, result1[3])
	assert_equal(0.1, result1[4])
	assert_equal("string", result1[5])

	local call2 = function(...)
		error("Error from call2")
		return ...
	end

	local result2 = { tryCall(call2, true, 1, 0.1, "string") }
	assert_false(result2[1])
end
